<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加对战</title>
</head>
<body>

<form class="layui-form" lay-filter="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                <blockquote class="layui-elem-quote">基础信息</blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        阵容标题</label>
                    <div class="layui-input-block" style="width:300px;">
                        <input class="layui-input account" name="title" placeholder="请输入阵容标题，最多输入16字"
                               autocomplete="off" lay-verify="required|account" lay-min="16" type="text" id="titleId">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        赛季标签</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="season"
                             data-sourceType="data"
                             data-source="[{name:'PK',value:'PK'},{name:'S1',value:'S1'},{name:'S2',value:'S2'},{name:'S3',value:'S3'}]"
                             data-radio="true"
                             data-layVerify="required"
                             data-placeholder="请选择赛季版本"
                             data-onchange="onChangeSeason"
                        ></div>
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        就业场景</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="job"
                             data-sourceType="data"
                             data-source="[{name:'PVP',value:'PVP'},{name:'打地',value:'打地'},{name:'开荒',value:'开荒'}]"
                             data-radio="true"
                             data-layVerify="required"
                             data-placeholder="请选择就业场景"
                        ></div>
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        适用范围</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="right_range"
                             data-sourceType="data"
                             data-source="[{name:'顶配',value:'顶配'},{name:'豪华',value:'豪华'},{name:'平民',value:'平民'}]"
                             data-radio="true"
                             data-layVerify="required"
                             data-placeholder="请选择适用范围"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        兵种</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="arms"
                             data-sourceType="route"
                             data-source="/admin.sgz.war_methods/getArms"
                             data-radio="true"
                             data-layVerify="required"
                             data-valueField="arm"
                             data-textField="arm"
                             data-placeholder="请选择兵种"
                        ></div>
                    </div>

                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        作者</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="user"
                             data-sourceType="route"
                             data-source="/admin.sgz.user/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="nickname"
                             data-radio="true"
                             data-layVerify="required"
                             data-placeholder="请选择作者"
                        ></div>
                    </div>
                </div>

                <blockquote class="layui-elem-quote">主将信息（主副将选择不可一致）
                    <span style="color: red">
                        (战法可多选，最多自选2个战法)、（S1赛季无兵书，S2赛季可携带2兵书（1大兵书、1小兵书）， S3赛季、PK赛季可携带3个兵书（1大兵书、2小兵书）
                    </span>
                </blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        主将</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="generals_id1"
                             data-sourceType="route"
                             data-source="/admin.sgz.generals/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="true"
                             data-layVerify="required|restrChoose1"
                             data-placeholder="请选择主将"
                             data-onchange="onChangeGeneralsId1"
                             id="generals_id1"
                        ></div>
                    </div>

                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="warMethods1"
                             data-sourceType="route"
                             data-source="/admin.sgz.war_methods/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="2"
                             data-layVerify="required"
                             data-placeholder="请选择战法"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item" id="bookOne">
                    <label class="layui-form-label">大兵书选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="bigBook1"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"1","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="1"
                             data-placeholder="请选择大兵书"
                        ></div>
                    </div>

                    <label class="layui-form-label"> 小兵书选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="smallBook1_1"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"2","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="1"
                             data-placeholder="请选择小兵书"
                             data-layVerify="restrSmallBoook1"
                             data-onchange="onChangeSmallBook1"
                        ></div>
                    </div>

                    <label class="layui-form-label" id="small">小兵书选择</label>
                    <div class="layui-input-inline" id="small_2">
                        <div class="xmSelect"
                             data-name="smallBook1_2"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"2","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="1"
                             data-placeholder="请选择小兵书"
                             data-layVerify="restrSmallBoook1"
                             data-onchange="onChangeSmallBook2"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">武力加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="addPoint" type="number" min="0" max="50" name="force1" lay-verify="number|maxNum"
                               lay-max="50" value="0" autocomplete="off" placeholder="请输入武力加点数字"
                               class="layui-input" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
                               οninput="value=value.replace(/[^\d.]/g,'')">
                        <button id="addPoint1" type="button" lay-filter="point"
                                class="laytp-btn laytp-btn-primary laytp-btn-md" style="margin:0 10px">+ 10
                        </button>
                        <button id="addPoint2" type="button" lay-filter="point"
                                class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50
                        </button>
                    </div>

                    <label class="layui-form-label">智力加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="gence" type="number" min="0" max="50" lay-verify="number|maxNum" lay-max="50"
                               name="intelligence1" value="0" autocomplete="off" placeholder="请输入智力加点数字"
                               class="layui-input">
                        <button id="gence1" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="gence2" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">统帅加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="chief" type="number" min="0" max="50" name="commander1" lay-verify="number|maxNum"
                               lay-max="50" value="0" autocomplete="off" placeholder="请输入统帅加点数字"
                               class="layui-input">
                        <button id="chief1" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="chief2" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>

                    <label class="layui-form-label">速度加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="speed" type="number" min="0" max="50" lay-verify="number|maxNum" lay-max="50"
                               name="speed1" value="0" lay-verify="number" autocomplete="off"
                               placeholder="请输入速度加点数字" class="layui-input">
                        <button id="speed1" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="speed2" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>
                </div>

                <blockquote class="layui-elem-quote">副将信息（主副将选择不可一致） <span style="color: red">
                        (战法可多选，最多自选2个战法)、（S1赛季无兵书，S2赛季可携带2兵书（1大兵书、1小兵书）， S3赛季、PK赛季可携带3个兵书（1大兵书、2小兵书）
                    </span></blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        副将</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="generals_id2"
                             data-sourceType="route"
                             data-source="/admin.sgz.generals/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="true"
                             data-layVerify="required|restrChoose2"
                             data-placeholder="请选择副将"
                             data-onchange="onChangeGeneralsId2"
                             id="generals_id2"
                        ></div>
                    </div>

                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="warMethods2"
                             data-sourceType="route"
                             data-source="/admin.sgz.war_methods/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="2"
                             data-layVerify="required"
                             data-placeholder="请选择战法"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item" id="bookTwo">
                    <label class="layui-form-label">大兵书选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="bigBook2"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"1","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="1"
                             data-placeholder="请选择大兵书"
                        ></div>
                    </div>

                    <label class="layui-form-label"> 小兵书选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="smallBook2_1"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"2","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="1"
                             data-placeholder="请选择小兵书"
                             data-layVerify="restrSmallBoook2"
                             data-onchange="onChangeSmallBook3"
                        ></div>
                    </div>

                    <label class="layui-form-label" id="small_3">小兵书选择</label>
                    <div class="layui-input-inline" id="small_4">
                        <div class="xmSelect"
                             data-name="smallBook2_2"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"2","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="1"
                             data-placeholder="请选择小兵书"
                             data-layVerify="restrSmallBoook2"
                             data-onchange="onChangeSmallBook4"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">武力加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="force" type="number" min="0" max="50" lay-verify="number|maxNum2" lay-max="50"
                               name="force2" lay-verify="number" autocomplete="off"
                               placeholder="请输入武力加点数字" value="0" class="layui-input">
                        <button id="force1" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="force2" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>

                    <label class="layui-form-label">智力加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="gence3" type="number" min="0" max="50" lay-verify="number|maxNum2" lay-max="50"
                               name="intelligence2" lay-verify="number" autocomplete="off"
                               placeholder="请输入智力加点数字" value="0" class="layui-input">
                        <button id="gence4" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="gence5" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">统帅加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="chief3" type="number" min="0" max="50" lay-verify="number|maxNum2" lay-max="50"
                               name="commander2" lay-verify="number" autocomplete="off"
                               placeholder="请输入统帅加点数字" value="0" class="layui-input">
                        <button id="chief4" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="chief5" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>

                    <label class="layui-form-label">速度加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="speed3" type="number" min="0" max="50" lay-verify="number|maxNum2" lay-max="50"
                               name="speed2" lay-verify="number" autocomplete="off"
                               placeholder="请输入速度加点数字" value="0" class="layui-input">
                        <button id="speed4" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="speed5" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>
                </div>


                <blockquote class="layui-elem-quote">副将信息（主副将选择不可一致） <span style="color: red">
                        (战法可多选，最多自选2个战法)、（S1赛季无兵书，S2赛季可携带2兵书（1大兵书、1小兵书）， S3赛季、PK赛季可携带3个兵书（1大兵书、2小兵书）
                    </span></blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        副将</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="generals_id3"
                             data-sourceType="route"
                             data-source="/admin.sgz.generals/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="true"
                             data-layVerify="required|restrChoose3"
                             data-placeholder="请选择副将"
                             data-onchange="onChangeGeneralsId3"
                             id="generals_id3"
                        ></div>
                    </div>

                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战法选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="warMethods3"
                             data-sourceType="route"
                             data-source="/admin.sgz.war_methods/index"
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="2"
                             data-layVerify="required"
                             data-placeholder="请选择战法"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item" id="bookThree">
                    <label class="layui-form-label">大兵书选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="bigBook3"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"1","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-placeholder="请选择大兵书"
                             data-radio="false"
                             data-max="1"
                        ></div>
                    </div>

                    <label class="layui-form-label"> 小兵书选择</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="smallBook3_1"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"2","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="1"
                             data-placeholder="请选择小兵书"
                             data-layVerify="restrSmallBoook3"
                             data-onchange="onChangeSmallBook5"
                        ></div>
                    </div>

                    <label class="layui-form-label" id="small_5">小兵书选择</label>
                    <div class="layui-input-inline" id="small_6">
                        <div class="xmSelect"
                             data-name="smallBook3_2"
                             data-sourceType="route"
                             data-source="/admin.sgz.book/index"
                             data-params='{"search_param":{"type":{"value":"2","condition":"="}}}'
                             data-sourceTree="false"
                             data-paging="true"
                             data-valueField="id"
                             data-textField="name"
                             data-radio="false"
                             data-max="1"
                             data-placeholder="请选择小兵书"
                             data-layVerify="restrSmallBoook3"
                             data-onchange="onChangeSmallBook6"
                        ></div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label"> 武力加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="force3" type="number" min="0" max="50" name="force3" lay-verify="number|maxNum3"
                               autocomplete="off" placeholder="请输入武力加点数字" value="0" class="layui-input">
                        <button id="force4" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="force5" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>

                    <label class="layui-form-label"> 智力加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="gence6" type="number" min="0" max="50" lay-verify="number|maxNum3" lay-max="50"
                               name="intelligence3" lay-verify="number" autocomplete="off"
                               placeholder="请输入智力加点数字" value="0" class="layui-input">
                        <button id="gence7" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="gence8" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"> 统帅加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="chief6" type="number" min="0" max="50" lay-verify="number|maxNum3" lay-max="50"
                               name="commander3" lay-verify="number" autocomplete="off"
                               placeholder="请输入统帅加点数字" value="0" class="layui-input">
                        <button id="chief7" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="chief8" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>

                    <label class="layui-form-label">速度加点</label>
                    <div class="layui-input-inline" style="width: 300px; display: flex">
                        <input id="speed6" type="number" min="0" max="50" lay-verify="number|maxNum3" lay-max="50"
                               name="speed3" lay-verify="number" autocomplete="off"
                               placeholder="请输入速度加点数字" value="0" class="layui-input">
                        <button id="speed7" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md"
                                style="margin:0 10px">+ 10
                        </button>
                        <button id="speed8" type="button" class="laytp-btn laytp-btn-primary laytp-btn-md">+ 50</button>
                    </div>
                </div>

                <blockquote class="layui-elem-quote">其余信息</blockquote>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        阵容说明</label>
                    <div class="layui-input-block">
                        <textarea name="description" id="attr3" lay-verify="required|maxDesc" lay-max="400"
                                  placeholder="请输入阵容说明，最多可输入400字" class="layui-textarea"
                                  lay-verify=""></textarea>
                    </div>


                </div>


                <div class="layui-form-item">
                    <text style="color:red;">建议尺寸为16:9，最多上传9张，
                        如需要上传9:16图片，建议9张
                        图片全部按照一个比例上传
                    </text>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        战报上传</label>
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="imgs"
                             data-dir="xm_game/sgz/team/img"
                             data-accept="image"
                             data-type="ali-oss"
                             data-layVerify="required|imageMax"
                             data-showChoiceBtn="false"
                             data-multi="true"
                             data-max="9"
                             data-uploadedCallback="callbackFun"
                             id="uploadImage"
                        ></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="add">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="laytp-btn laytp-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script>
    if (localStorage.getItem("staticDomain")) {
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/jquery_3.3.1.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/jquery.tablednd.js?v=" + localStorage.getItem("version") + "'><\/script>");
    } else {
        document.write("<link rel='stylesheet' href='/static/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='/static/component/layui/layui.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/jquery_3.3.1.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/jquery.tablednd.js?v=" + localStorage.getItem("version") + "'><\/script>");
    }
</script>
<script>
    layui.use(['jquery', 'laytp'], function () {
        var $ = layui.$;






        // 删除标题前后空格
        $(document).ready(function(){
            $('#titleId').blur(function () {
                $('#titleId').val($('#titleId').val().trim())
            })
        })

        var generals_id1
        var generals_id2
        var generals_id3
        var smallBook1
        var smallBook2
        var smallBook3
        var smallBook4
        var smallBook5
        var smallBook6

        window.onChangeGeneralsId1 = function (params) {
            const curId = params.change[0].id
            generals_id1 = curId
        }

        window.onChangeGeneralsId2 = function (params) {
            const curId = params.change[0].id
            generals_id2 = curId
        }

        window.onChangeGeneralsId3 = function (params) {
            const curId = params.change[0].id
            generals_id3 = curId
        }

        // 小兵书选择
        window.onChangeSmallBook1 = function (params) {

            try {
                if(params.arr.length == 0){throw new Error()}
                const curId = params.change[0].id
                smallBook1 = curId
                // console.log(params)
                // console.log('=====>>>1')
            }catch (e) {
                smallBook1 = undefined
                // console.log(params)
                // console.log('=====>>>2')
            }
        }

        window.onChangeSmallBook2 = function (params) {
            try{
                if(params.arr.length == 0){throw new Error()}
                const curId = params.change[0].id
                smallBook2 = curId
            } catch (e) {
                smallBook2 = undefined
            }

        }

        window.onChangeSmallBook3 = function (params) {


            try{
                if(params.arr.length == 0){throw new Error()}
                const curId = params.change[0].id
                smallBook3 = curId
            } catch (e) {
                smallBook3 = undefined
            }
        }

        window.onChangeSmallBook4 = function (params) {

            try{
                if(params.arr.length == 0){throw new Error()}
                const curId = params.change[0].id
                smallBook4 = curId
            } catch (e) {
                smallBook4 = undefined
            }
        }

        window.onChangeSmallBook5 = function (params) {

            try{
                if(params.arr.length == 0){throw new Error()}
                const curId = params.change[0].id
                smallBook5 = curId
            } catch (e) {
                smallBook5 = undefined
            }
        }

        window.onChangeSmallBook6 = function (params) {


            try{
                if(params.arr.length == 0){throw new Error()}
                const curId = params.change[0].id
                smallBook6 = curId
            }catch (e) {
                smallBook6 = undefined
            }
        }

        // 小兵书结束

        window.onChangeSeason = function (params) {
            console.log('旧s')

            const curSeasonName = params.change[0].name
            if (curSeasonName == 'S1') {
                $('#bookOne').css('display', 'none')
                $('#bookTwo').css('display', 'none')
                $('#bookThree').css('display', 'none')
            }
            ;
            if (curSeasonName == 'S2') {
                $('#bookOne').css('display', 'block')
                $('#bookTwo').css('display', 'block')
                $('#bookThree').css('display', 'block')
                $('#small').css('display', 'none')
                $('#small_2').css('display', 'none')
                $('#small_3').css('display', 'none')
                $('#small_4').css('display', 'none')
                $('#small_5').css('display', 'none')
                $('#small_6').css('display', 'none')
            }
            ;
            if (curSeasonName == 'S3' || curSeasonName == 'PK') {
                $('#bookOne').css('display', 'block')
                $('#bookTwo').css('display', 'block')
                $('#bookThree').css('display', 'block')
                $('#small').css('display', 'block')
                $('#small_2').css('display', 'block')
                $('#small_3').css('display', 'block')
                $('#small_4').css('display', 'block')
                $('#small_5').css('display', 'block')
                $('#small_6').css('display', 'block')
            }
            ;
        }

        layui.form.verify({

            account: function (value, item) {
                var min = item.getAttribute('lay-min');
                if (value.length > min) {
                    return '阵容标题不能大于' + min + '个字符的长度';
                }
            },
            maxNum: function (value, item) {
                var max = item.getAttribute('lay-max');
                // if (Number(value) > Number(max)) {
                //     return '输入值必须小于50';
                // }
                const numberAll = Number($('#addPoint').val()) + Number($('#gence').val()) + Number($('#chief').val()) + Number($('#speed').val())

                if (Number(numberAll) > Number(50)) {
                    return '属性点增加总计不能大于50';
                }
            },

            maxNum2: function (value, item) {
                var max = item.getAttribute('lay-max');
                // if (Number(value) > Number(max)) {
                //     return '输入值必须小于50';
                // }

                const numberAll2 = Number($('#force').val()) + Number($('#gence3').val()) + Number($('#chief3').val()) + Number($('#speed3').val())


                if (Number(numberAll2) > Number(50)) {
                    return '属性点增加总计不能大于50';
                }
            },

            maxNum3: function (value, item) {
                var max = item.getAttribute('lay-max');

                const numberAll3 = Number($('#force3').val()) + Number($('#gence6').val()) + Number($('#chief6').val()) + Number($('#speed6').val())

                if (Number(numberAll3) > Number(50)) {
                    return '属性点增加总计不能大于50';
                }
            },
            maxDesc: function (value, item) {
                var max = item.getAttribute('lay-max');
                if (Number(value.length) > Number(max)) {
                    return '阵容说明不能大于400个字';
                }
            },
            restrChoose1: function (value, item) {
                if (generals_id1 == generals_id2 || generals_id1 == generals_id3) {
                    return '主副将不能一致';
                }
            },
            restrChoose2: function (value, item) {
                if (generals_id2 == generals_id1 || generals_id2 == generals_id3) {
                    return '主副将不能一致';
                }
            },
            restrChoose3: function (value, item) {
                if (generals_id3 == generals_id1 || generals_id3 == generals_id2) {
                    return '主副将不能一致';
                }
            },
            restrSmallBoook1: function (value, item) {
                if(smallBook1 !== undefined && smallBook2 !== undefined){
                    if (smallBook1 == smallBook2) {
                        return '小兵书不能一致';
                    }
                }

            },
            restrSmallBoook2: function (value, item) {
                console.log(smallBook3,smallBook4)
                if(smallBook3 !== undefined && smallBook4 !== undefined){
                    if (smallBook3 == smallBook4) {
                        return '小兵书不能一致';
                    }
                }

            },
            restrSmallBoook3: function (value, item) {
                console.log(smallBook5,smallBook6)
                if(smallBook5 !== undefined && smallBook6 !== undefined){
                    if (smallBook5 == smallBook6) {
                        return '小兵书不能一致';
                    }
                }

            },
             imageMax: function (value, item){
                 // console.log('999==>')
                 // console.log($('#uploadImage').val())
                 // console.log(value)
                 // console.log(item)
                 try {
                     const newMax = value.split(',')
                     console.log(newMax.length)
                     if(newMax.length > 9){
                         return '上传图片最多为9张'
                     }
                 }
                 catch (e) {
                     console.log(e)
                 }
                 // console.log('999==>')
              }

        });

        // 主将
        $("#addPoint1").click(function () {
            const curNum = Number($('#addPoint').val())
            const curNum2 = Number($('#gence').val())
            const curNum3 = Number($('#chief').val())
            const curNum4 = Number($('#speed').val())

            if(curNum2 !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return


            $('#addPoint').val(Number(curNum) + 10)
        });

        $("#addPoint2").click(function () {
            const curNum = Number($('#addPoint').val())
            const curNum2 = Number($('#gence').val())
            const curNum3 = Number($('#chief').val())
            const curNum4 = Number($('#speed').val())

            if(curNum2 !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return

            $('#addPoint').val(Number(curNum) + 50)
        });

        $("#gence1").click(function () {
            // const curNum = $('#gence').val()

            const curNum = Number($('#addPoint').val())
            const curNum2 = Number($('#gence').val())
            const curNum3 = Number($('#chief').val())
            const curNum4 = Number($('#speed').val())

            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return


            $('#gence').val(Number(curNum2) + 10)
        });

        $("#gence2").click(function () {
            // const curNum = $('#gence').val()

            const curNum = Number($('#addPoint').val())
            const curNum2 = Number($('#gence').val())
            const curNum3 = Number($('#chief').val())
            const curNum4 = Number($('#speed').val())

            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return

            $('#gence').val(Number(curNum2) + 50)
        });

        $("#chief1").click(function () {
            // const curNum = $('#chief').val()

            const curNum = Number($('#addPoint').val())
            const curNum2 = Number($('#gence').val())
            const curNum3 = Number($('#chief').val())
            const curNum4 = Number($('#speed').val())

            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return

            $('#chief').val(Number(curNum3) + 10)
        });

        $("#chief2").click(function () {
            // const curNum = $('#chief').val()

            const curNum = Number($('#addPoint').val())
            const curNum2 = Number($('#gence').val())
            const curNum3 = Number($('#chief').val())
            const curNum4 = Number($('#speed').val())

            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return

            $('#chief').val(Number(curNum3) + 50)
        });

        $("#speed1").click(function () {
            // const curNum = $('#speed').val()

            const curNum = Number($('#addPoint').val())
            const curNum2 = Number($('#gence').val())
            const curNum3 = Number($('#chief').val())
            const curNum4 = Number($('#speed').val())

            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum3 !== 0) return

            $('#speed').val(Number(curNum4) + 10)
        });

        $("#speed2").click(function () {
            // const curNum = $('#speed').val()

            const curNum = Number($('#addPoint').val())
            const curNum2 = Number($('#gence').val())
            const curNum3 = Number($('#chief').val())
            const curNum4 = Number($('#speed').val())

            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum3 !== 0) return

            $('#speed').val(Number(curNum4) + 50)
        });

        // 副将1
        $("#force1").click(function () {
            const curNum = Number($('#force').val())
            const curNum2 = Number($('#gence3').val())
            const curNum3 = Number($('#chief3').val())
            const curNum4 = Number($('#speed3').val())

            if(curNum2 !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return

            $('#force').val(Number(curNum) + 10)
        });

        $("#force2").click(function () {
            const curNum = Number($('#force').val())
            const curNum2 = Number($('#gence3').val())
            const curNum3 = Number($('#chief3').val())
            const curNum4 = Number($('#speed3').val())

            if(curNum2 !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return

            $('#force').val(Number(curNum) + 50)
        });

        $("#gence4").click(function () {
            const curNum = Number($('#force').val())
            const curNum2 = Number($('#gence3').val())
            const curNum3 = Number($('#chief3').val())
            const curNum4 = Number($('#speed3').val())

            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return

            $('#gence3').val(Number(curNum2) + 10)
        });

        $("#gence5").click(function () {
            const curNum = Number($('#force').val())
            const curNum2 = Number($('#gence3').val())
            const curNum3 = Number($('#chief3').val())
            const curNum4 = Number($('#speed3').val())

            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return
            $('#gence3').val(Number(curNum2) + 50)
        });

        $("#chief4").click(function () {
            const curNum = Number($('#force').val())
            const curNum2 = Number($('#gence3').val())
            const curNum3 = Number($('#chief3').val())
            const curNum4 = Number($('#speed3').val())
            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return

            $('#chief3').val(Number(curNum3) + 10)
        });

        $("#chief5").click(function () {
            const curNum = Number($('#force').val())
            const curNum2 = Number($('#gence3').val())
            const curNum3 = Number($('#chief3').val())
            const curNum4 = Number($('#speed3').val())
            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return

            $('#chief3').val(Number(curNum3) + 50)
        });

        $("#speed4").click(function () {
            const curNum = Number($('#force').val())
            const curNum2 = Number($('#gence3').val())
            const curNum3 = Number($('#chief3').val())
            const curNum4 = Number($('#speed3').val())
            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum3 !== 0) return
            $('#speed3').val(Number(curNum4) + 10)
        });

        $("#speed5").click(function () {
            const curNum = Number($('#force').val())
            const curNum2 = Number($('#gence3').val())
            const curNum3 = Number($('#chief3').val())
            const curNum4 = Number($('#speed3').val())
            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum3 !== 0) return
            $('#speed3').val(Number(curNum4) + 50)
        });

        // 副将2
        $("#force4").click(function () {
            const curNum = Number($('#force3').val())
            const curNum2 = Number($('#gence6').val())
            const curNum3 = Number($('#chief6').val())
            const curNum4 = Number($('#speed6').val())
            if(curNum2 !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return

            $('#force3').val(Number(curNum) + 10)
        });

        $("#force5").click(function () {
            const curNum = Number($('#force3').val())
            const curNum2 = Number($('#gence6').val())
            const curNum3 = Number($('#chief6').val())
            const curNum4 = Number($('#speed6').val())
            if(curNum2 !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return
            $('#force3').val(Number(curNum) + 50)
        });

        $("#gence7").click(function () {
            const curNum = Number($('#force3').val())
            const curNum2 = Number($('#gence6').val())
            const curNum3 = Number($('#chief6').val())
            const curNum4 = Number($('#speed6').val())
            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return
            $('#gence6').val(Number(curNum2) + 10)
        });

        $("#gence8").click(function () {
            const curNum = Number($('#force3').val())
            const curNum2 = Number($('#gence6').val())
            const curNum3 = Number($('#chief6').val())
            const curNum4 = Number($('#speed6').val())
            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum3 !== 0 && curNum4 !== 0) return
            $('#gence6').val(Number(curNum2) + 50)
        });

        $("#chief7").click(function () {
            const curNum = Number($('#force3').val())
            const curNum2 = Number($('#gence6').val())
            const curNum3 = Number($('#chief6').val())
            const curNum4 = Number($('#speed6').val())
            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return
            $('#chief6').val(Number(curNum3) + 10)
        });

        $("#chief8").click(function () {
            const curNum = Number($('#force3').val())
            const curNum2 = Number($('#gence6').val())
            const curNum3 = Number($('#chief6').val())
            const curNum4 = Number($('#speed6').val())
            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum4 !== 0) return
            if(curNum2 !== 0 && curNum4 !== 0) return
            $('#chief6').val(Number(curNum3) + 50)
        });

        $("#speed7").click(function () {
            const curNum = Number($('#force3').val())
            const curNum2 = Number($('#gence6').val())
            const curNum3 = Number($('#chief6').val())
            const curNum4 = Number($('#speed6').val())
            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum3 !== 0) return
            $('#speed6').val(Number(curNum4) + 10)
        });

        $("#speed8").click(function () {
            const curNum = Number($('#force3').val())
            const curNum2 = Number($('#gence6').val())
            const curNum3 = Number($('#chief6').val())
            const curNum4 = Number($('#speed6').val())
            if(curNum !== 0 && curNum2 !== 0) return
            if(curNum !== 0 && curNum3 !== 0) return
            if(curNum2 !== 0 && curNum3 !== 0) return
            $('#speed6').val(Number(curNum4) + 50)
        });

        // 主将失去焦点/副将失去焦点
        $(document).ready(function(){
            // 主将
            $('#addPoint').blur(function () {
                const num = $('#addPoint').val()
                const num2 = Number($('#gence').val())
                const num3 = Number($('#chief').val())
                const num4 = Number($('#speed').val())

                if(num2 !== 0 && num3 !== 0){
                    $('#addPoint').val(0)
                    return
                }
                if(num2 !== 0 && num4 !== 0){
                    $('#addPoint').val(0)
                    return
                }
                if(num3 !== 0 && num4 !== 0){
                    $('#addPoint').val(0)
                    return
                }

                if(typeof num !== 'number' && num < 0){
                    $('#addPoint').val(0)
                } else {
                    $('#addPoint').val( Math.trunc($('#addPoint').val()))
                }
            })

            $('#gence').blur(function () {
                // const num = $('#gence').val()

                const num = Number($('#addPoint').val())
                const num2 = $('#gence').val()
                const num3 = Number($('#chief').val())
                const num4 = Number($('#speed').val())

                if(num !== 0 && num3 !== 0){
                    $('#gence').val(0)
                    return
                }
                if(num !== 0 && num4 !== 0){
                    $('#gence').val(0)
                    return
                }
                if(num3 !== 0 && num4 !== 0){
                    $('#gence').val(0)
                    return
                }



                if(typeof num2 !== 'number' && num2 < 0){
                    $('#gence').val(0)
                } else {
                    $('#gence').val( Math.trunc($('#gence').val()))
                }
            })

            $('#chief').blur(function () {
                // const num = $('#chief').val()

                const num = Number($('#addPoint').val())
                const num2 = Number($('#gence').val())
                const num3 = $('#chief').val()
                const num4 = Number($('#speed').val())

                if(num !== 0 && num2 !== 0){
                    $('#chief').val(0)
                    return
                }
                if(num !== 0 && num4 !== 0){
                    $('#chief').val(0)
                    return
                }
                if(num2 !== 0 && num4 !== 0){
                    $('#chief').val(0)
                    return
                }


                if(typeof num3 !== 'number' && num3 < 0){
                    $('#chief').val(0)
                } else {
                    $('#chief').val( Math.trunc($('#chief').val()))
                }
            })

            $('#speed').blur(function () {
                // const num = $('#speed').val()

                const num = Number($('#addPoint').val())
                const num2 = Number($('#gence').val())
                const num3 = Number($('#chief').val())
                const num4 = $('#speed').val()

                if(num !== 0 && num2 !== 0){
                    $('#speed').val(0)
                    return
                }
                if(num !== 0 && num3 !== 0){
                    $('#speed').val(0)
                    return
                }
                if(num2 !== 0 && num3 !== 0){
                    $('#speed').val(0)
                    return
                }

                if(typeof num4 !== 'number' && num4 < 0){
                    $('#speed').val(0)
                } else {
                    $('#speed').val( Math.trunc($('#speed').val()))
                }
            })

            // 副将1
            $('#force').blur(function () {
                const num = $('#force').val()
                const num2 = Number($('#gence3').val())
                const num3 = Number($('#chief3').val())
                const num4 = Number($('#speed3').val())
                if(num2 !== 0 && num3 !== 0){
                    $('#force').val(0)
                    return
                }
                if(num2 !== 0 && num4 !== 0){
                    $('#force').val(0)
                    return
                }
                if(num3 !== 0 && num4 !== 0){
                    $('#force').val(0)
                    return
                }

                if(typeof num !== 'number' && num < 0){
                    $('#force').val(0)
                } else {
                    $('#force').val( Math.trunc($('#force').val()))
                }
            })

            $('#gence3').blur(function () {
                // const num = $('#gence3').val()
                const num = Number($('#force').val())
                const num2 = $('#gence3').val()
                const num3 = Number($('#chief3').val())
                const num4 = Number($('#speed3').val())
                if(num !== 0 && num3 !== 0){
                    $('#gence3').val(0)
                    return
                }
                if(num !== 0 && num4 !== 0){
                    $('#gence3').val(0)
                    return
                }
                if(num3 !== 0 && num4 !== 0){
                    $('#gence3').val(0)
                    return
                }

                if(typeof num2 !== 'number' && num2 < 0){
                    $('#gence3').val(0)
                } else {
                    $('#gence3').val( Math.trunc($('#gence3').val()))
                }
            })

            $('#chief3').blur(function () {
                // const num = $('#chief3').val()
                const num = Number($('#force').val())
                const num2 = Number($('#gence3').val())
                const num3 = $('#chief3').val()
                const num4 = Number($('#speed3').val())
                if(num !== 0 && num2 !== 0){
                    $('#chief3').val(0)
                    return
                }
                if(num !== 0 && num4 !== 0){
                    $('#chief3').val(0)
                    return
                }
                if(num2 !== 0 && num4 !== 0){
                    $('#chief3').val(0)
                    return
                }


                if(typeof num3 !== 'number' && num3 < 0){
                    $('#chief3').val(0)
                } else {
                    $('#chief3').val( Math.trunc($('#chief3').val()))
                }
            })

            $('#speed3').blur(function () {
                // const num = $('#speed3').val()
                const num = Number($('#force').val())
                const num2 = Number($('#gence3').val())
                const num3 = Number($('#chief3').val())
                const num4 = $('#speed3').val()
                if(num !== 0 && num2 !== 0){
                    $('#speed3').val(0)
                    return
                }
                if(num !== 0 && num3 !== 0){
                    $('#speed3').val(0)
                    return
                }
                if(num2 !== 0 && num3 !== 0){
                    $('#speed3').val(0)
                    return
                }

                if(typeof num4 !== 'number' && num4 < 0){
                    $('#speed3').val(0)
                } else {
                    $('#speed3').val( Math.trunc($('#speed3').val()))
                }
            })

            // 副将2
            $('#force3').blur(function () {
                const num = $('#force3').val()
                const num2 = Number($('#gence6').val())
                const num3 = Number($('#chief6').val())
                const num4 = Number($('#speed6').val())
                if(num2 !== 0 && num3 !== 0){
                    $('#force3').val(0)
                    return
                }
                if(num2 !== 0 && num4 !== 0){
                    $('#force3').val(0)
                    return
                }
                if(num3 !== 0 && num4 !== 0){
                    $('#force3').val(0)
                    return
                }

                if(typeof num !== 'number' && num < 0){
                    $('#force3').val(0)
                } else {
                    $('#force3').val( Math.trunc($('#force3').val()))
                }
            })

            $('#gence6').blur(function () {
                // const num = $('#gence6').val()
                const num = Number($('#force3').val())
                const num2 = $('#gence6').val()
                const num3 = Number($('#chief6').val())
                const num4 = Number($('#speed6').val())
                if(num !== 0 && num3 !== 0){
                    $('#gence6').val(0)
                    return
                }
                if(num !== 0 && num4 !== 0){
                    $('#gence6').val(0)
                    return
                }
                if(num3 !== 0 && num4 !== 0){
                    $('#gence6').val(0)
                    return
                }

                if(typeof num2 !== 'number' && num2 < 0){
                    $('#gence6').val(0)
                } else {
                    $('#gence6').val( Math.trunc($('#gence6').val()))
                }
            })

            $('#chief6').blur(function () {
                // const num = $('#chief6').val()
                const num = Number($('#force3').val())
                const num2 = Number($('#gence6').val())
                const num3 = $('#chief6').val()
                const num4 = Number($('#speed6').val())
                if(num !== 0 && num2 !== 0){
                    $('#chief6').val(0)
                    return
                }
                if(num !== 0 && num4 !== 0){
                    $('#chief6').val(0)
                    return
                }
                if(num2 !== 0 && num4 !== 0){
                    $('#chief6').val(0)
                    return
                }

                if(typeof num3 !== 'number' && num3 < 0){
                    $('#chief6').val(0)
                } else {
                    $('#chief6').val( Math.trunc($('#chief6').val()))
                }
            })

            $('#speed6').blur(function () {
                // const num = $('#speed6').val()
                const num = Number($('#force3').val())
                const num2 = Number($('#gence6').val())
                const num3 = Number($('#chief6').val())
                const num4 = $('#speed6').val()
                if(num !== 0 && num2 !== 0){
                    $('#speed6').val(0)
                    return
                }
                if(num !== 0 && num3 !== 0){
                    $('#speed6').val(0)
                    return
                }
                if(num2 !== 0 && num3 !== 0){
                    $('#speed6').val(0)
                    return
                }

                if(typeof num4 !== 'number' && num4 < 0){
                    $('#speed6').val(0)
                } else {
                    $('#speed6').val( Math.trunc($('#speed6').val()))
                }
            })
        })

        layui.form.on('submit(add)', function (data) {
            var btnAnim = layui.button.load({elem: $(this)});

            console.log(btnAnim)
            console.log(data.field)


            const dataNew = { generals: []}
            dataNew.user_id = data.field.user
            dataNew.title = data.field.title
            dataNew.season = data.field.season
            dataNew.job = data.field.job
            dataNew.right_range = data.field.right_range
            dataNew.arms = data.field.arms
            dataNew.description = data.field.description
            dataNew.imgs = data.field.imgs

            dataNew.generals.push({
                    "generals_id": data.field.generals_id1,
                    "position": 1,
                    "force": data.field.force1,
                    "intelligence": data.field.intelligence1,
                    "commander": data.field.commander1,
                    "speed": data.field.speed1,
                    "warMethods": data.field.warMethods1.split(','), //战法
                    "bigBook": data.field.bigBook1 ? data.field.bigBook1.split(',') : undefined, //大兵书
                    "smallBook": data.field.season == 'S1' ? undefined : data.field.season == 'S2' ?
                        data.field.smallBook1_1 == '' ? undefined : [data.field.smallBook1_1] : data.field.season == 'S3' ?
                            [data.field.smallBook1_1 , data.field.smallBook1_2] :
                            data.field.season == 'PK' ?
                                [data.field.smallBook1_1 , data.field.smallBook1_2]: []
                },
                {
                    "generals_id": data.field.generals_id2,
                    "position": 2,
                    "force": data.field.force2,
                    "intelligence": data.field.intelligence2,
                    "commander": data.field.commander2,
                    "speed": data.field.speed2,
                    "warMethods": data.field.warMethods2.split(','), //战法
                    "bigBook": data.field.bigBook2 ? data.field.bigBook2.split(',') : undefined, //大兵书
                    "smallBook": data.field.season == 'S1' ? undefined : data.field.season == 'S2' ?
                        data.field.smallBook2_1 == '' ? undefined : [data.field.smallBook2_1] : data.field.season == 'S3' ?
                            [data.field.smallBook2_1 , data.field.smallBook2_2] :  data.field.season == 'PK' ?
                                [data.field.smallBook2_1 , data.field.smallBook2_2]: []
                },
                {
                    "generals_id": data.field.generals_id3,
                    "position": 2,
                    "force": data.field.force3,
                    "intelligence": data.field.intelligence3,
                    "commander": data.field.commander3,
                    "speed": data.field.speed3,
                    "warMethods": data.field.warMethods3.split(','), //战法
                    "bigBook": data.field.bigBook3 ? data.field.bigBook3.split(',') : undefined, //大兵书
                    "smallBook": data.field.season == 'S1' ? undefined : data.field.season == 'S2' ?
                        data.field.smallBook3_1 == '' ? undefined : [data.field.smallBook3_1] : data.field.season == 'S3' ?
                            [data.field.smallBook3_1 , data.field.smallBook3_2] :  data.field.season == 'PK' ?
                                [data.field.smallBook3_1 , data.field.smallBook3_2]: []


                })

            console.log(dataNew)

            facade.ajax({
                route: '/admin.sgz.team/add',
                data: dataNew
            }).done(function (res) {
                if (res.code === 0) {
                    parent.layui.layer.close(parent.layui.layer.getFrameIndex(window.name));//关闭当前页
                    parent.layui.table.reload("laytp-table");
                }
                btnAnim.stop();
            }).fail(function () {
                btnAnim.stop();
            });
            return false;
        });
    })

    var buttonData = layui.form.on('addPoint(point)', function (data) {
        var btnPoint = layui.button.load({elem: $(this)});
        console.log(data);
        return data;
    });

</script>

</body>
</html>